package models

import (
	"time"
)

type Comment struct {
	ID        uint      `json:"id" gorm:"primary_key"`
	Content   string    `json:"content" gorm:"not null"`
	PostID    uint      `json:"post_id"`
	Post      Post      `json:"post,omitempty" gorm:"foreignkey:PostID"`
	AuthorID  uint      `json:"author_id"`
	Author    User      `json:"author" gorm:"foreignkey:AuthorID"`
	ParentID  *uint     `json:"parent_id"` // 用于回复评论
	Parent    *Comment  `json:"parent,omitempty" gorm:"foreignkey:ParentID"`
	Replies   []Comment `json:"replies,omitempty" gorm:"foreignkey:ParentID"`
	Status    string    `json:"status" gorm:"default:'approved'"` // pending, approved, rejected
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}
